package com.github.sevenmall.orderservice.service.impl;

import com.github.sevenmall.orderservice.dao.SevenOrderMapper;import com.github.sevenmall.orderservice.pojo.do0.SevenOrder;import com.github.sevenmall.orderservice.service.OrderService;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.stereotype.Service;import java.util.List;
import java.util.concurrent.ThreadPoolExecutor;

/**
 * @author 杜科
 * @description
 * @contact AllenDuke@163.com
 * @date 2020/8/19
 */
@Service
public class OrderServiceImpl implements OrderService {

    @Autowired
    SevenOrderMapper orderMapper;

    @Autowired
    ThreadPoolExecutor executor;

    @Override
    public void save(SevenOrder order) {
        executor.execute(()->orderMapper.insert(order));
    }

    @Override
    public void delate(Long orderId) {
        orderMapper.deleteByPrimaryKey(orderId);
    }

    @Override
    public SevenOrder getOrder(Long orderId) {
        orderMapper.selectByPrimaryKey(orderId);
        return null;
    }

    @Override
    public List<SevenOrder> getOrdersByUserId(Integer userId) {
        return null;
    }

    @Override
    public void update(SevenOrder order) {
        executor.execute(()->orderMapper.updateByPrimaryKey(order));
    }
}
